﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Telerik.Web.Mvc;
using PeopleSource.Utl;
using PeopleSource.Entities;

namespace PeopleSource.Controllers
{
    public class ResumeTypeController : Controller
    {
        //
        // GET: /ResumeType/

        public ActionResult Index()
        {
            return View();
        }
        [GridAction]
        public ActionResult _SelectIndex()
        {
            return View(new GridModel((CH.GetAllDatas<ResumeType>()))); 
        }

        [AcceptVerbs(HttpVerbs.Post)]
        [GridAction]
        public ActionResult _SaveAjaxEditing(int? id)
        {
            var item = CH.GetDataByID<ResumeType>(id);

            if (TryUpdateModel(item))
            {

                CH.Edit<ResumeType>(item);
            }
            return View(new GridModel((CH.GetAllDatas<ResumeType>())));
        }

        [AcceptVerbs(HttpVerbs.Post)]
        [GridAction]
        public ActionResult _InsertAjaxEditing(int? id)
        {
            var item = new ResumeType();

            if (TryUpdateModel(item))
            {

                CH.Create<ResumeType>(item);
            }
            return View(new GridModel((CH.GetAllDatas<ResumeType>())));
        }

        [AcceptVerbs(HttpVerbs.Post)]
        [GridAction]
        public ActionResult _DeleteAjaxEditing(int? id)
        {
            CH.Delete<ResumeType>(id);
            return View(new GridModel((CH.GetAllDatas<ResumeType>())));
        }


    }
}
